var _util = require('util/util.js')

var _cart_service = {
    getCartItemList : function(resolve, reject){
        _util.request({
            url     : _util.getServerURL('cart/cartItems'),
            method  : 'GET',
            success : resolve,
            error   : reject
        });
    },
    removeCartItem : function(itemId,resolve,reject){
        _util.request({
            url     : _util.getServerURL('cart/cartItems/'+itemId),
            method  : 'DELETE',
            success : resolve,
            error   : reject
        });
    },
    updateCart : function(itemId,num,resolve,reject){
        _util.request({
            url     : _util.getServerURL('cart/cartItems/'+ itemId +'/quantity/' + num),
            method  : 'POST',
            success : resolve,
            error   : reject
        });
    }
    
};

module.exports = _cart_service;